home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / dvlprstc.hqx / Developer Stack 1.3r / card_30953.txt < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.9 KB  |  93 lines

  1. -- card: 30953 from stack: in.3r
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3837
  5. -- name: CopyFile
  6.  
  7.  
  8. -- part 2 (button)
  9. -- low flags: 00
  10. -- high flags: A004
  11. -- rect: left=201 top=233 right=283 bottom=268
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 27056 / 27056
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Try It
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   put "Please select a file to copy..."
  23.   put filename() into myfile
  24.   hide message
  25.   if myFile is empty then exit mouseup
  26.  
  27.   set cursor to 4
  28.   put lastPathComponent(myfile) into newName
  29.   ask "Please name the copy" with "Copy of"&&newName
  30.   if it is empty then exit mouseup
  31.   put it into newName
  32.   set cursor to 4
  33.   put copyFile(myFile,newName) into myResult
  34.   if myResult<>0 then
  35.     OSErr "┬⌐1988SDrazga",myResult
  36.   else
  37.     Answer "Copy successful!"
  38.   end if
  39. end mouseUp
  40.  
  41.  
  42.  
  43.  
  44. -- part contents for background part 5
  45. ----- text -----
  46. CopyFile
  47.  
  48. -- part contents for background part 6
  49. ----- text -----
  50. The CopyFile XFCN was written by Brad J. Hicks to give HyperCard the ability to copy a file (such as a stack) with full script control (necessary for making backup copies of a stack automatically, for example).
  51.  
  52. Use it freely, but I would appreciate a thank-you or acknowledgement somewhere in the stack.  
  53.  
  54. Brad J. Hicks
  55. FidoNet:
  56. 1:100/523
  57. CompuServe:
  58. [76012,300]
  59. US Mail:
  60. 11215 Sugartrail
  61. St. Louis, MO 63136
  62.  
  63.  
  64. -- part contents for background part 7
  65. ----- text -----
  66. Syntax:
  67.  
  68. copyFile(<oldFile>,<newFile>)
  69.  
  70. If there aren't two parameters, copyFile returns 1; otherwise, it's the standard Macintosh error code (you can use the OSErr* XCMD to report these errors to the user.
  71.  
  72.  
  73. The first parameter is the full path name to the original file.
  74.  
  75. The second parameter is the name of the copy of the original file.
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. -- part contents for background part 10
  88. ----- text -----
  89. 26
  90.  
  91. -- part contents for background part 27
  92. ----- text -----
  93. XFCN